#include "XPlay2.h"
#include <qfiledialog.h>
#include <QDebug>
#include "XDemuxThread.h"
#include <qmessagebox.h>
static XDemuxThread dt;
XPlay2::XPlay2(QWidget *parent)
    : QWidget(parent)
{
    ui.setupUi(this);
	dt.Start();
}

void XPlay2::OpenFile()
{
	//选择文件
	QString name = QFileDialog::getOpenFileName(this,QString::fromLocal8Bit("选择视频文件"));
	if (name.isEmpty()) return;
	this->setWindowTitle(name);
	int ret = dt.Open(name.toLocal8Bit(),ui.video);
	if (ret == false) {
		QMessageBox::information(0, "error", "Open file failed");
		return;
	}
	qDebug() << name;
	
}